import newRequest from "@/utils/http/newRequest";

//品牌列表中每一个品牌的具体类型
export interface trademarkItemType {
    id?: number;
    tmName: string; //品牌名称
    logoUrl: string; //品牌logo
  }
  
  //品牌列表的数组类型
  export type trademarkListType = trademarkItemType[];
  
  //品牌分页列表的返回值类型
  export interface trademarkListReturnType {
    records: trademarkListType; //品牌列表数据
    total: number; //总条数
    size: number; //每页条数
    current: number; //当前页
    searchCount: boolean;
    pages: number; //总页数
  }

//1.请求分页列表
export const reqTrademarkList = (page: number, limit: number) => {
    return newRequest.get<any, trademarkListReturnType>(`/admin/product/baseTrademark/${page}/${limit}`)
} 
//2.新增品牌的请求
export const reqAddTrademark=( tmName: string,logoUrl: string)=>{
    return newRequest.post<null, null>('/admin/product/baseTrademark/save',{
        tmName,
        logoUrl,
    })
}

//3. 修改品牌请求
export const reqUpdateTrademark = (tmInfo: trademarkItemType) => {
    return newRequest.put<null, null>(`/admin/product/baseTrademark/update`, tmInfo);
  };
  
  //4. 删除品牌的请求
  export const reqDeleteTrademark = (id: number) => {
    return newRequest.delete<null, null>(
      `/admin/product/baseTrademark/remove/${id}`
    );
  };
  